package cn.xinzhi.test;

import cn.xinzhi.dao.IUserInfoDao;
import cn.xinzhi.entity.UserInfo;
import cn.xinzhi.until.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Mybatis_Main {
    public static void main(String[] args) {
        SqlSession ss = MyBatisUtil.getSqlSession();
        IUserInfoDao mapper = ss.getMapper(IUserInfoDao.class);
        UserInfo ui = new UserInfo();
            ui.setUserid(2);
            ui.setUsername("wwww");
            ui.setUserpassword("SDSDSDS");
            ui.setUsersex("世界");
//            ui.setUserage(6);
            int count=mapper.updateUser(ui);
        System.out.println(count>0?"修改成功":"修改失败");

        ss.commit();
//        List<UserInfo> ub = mapper.getUserByCondition(ui);
//        for (UserInfo ui1:ub) {
//            System.out.println(ui1.getUsername()+ "---" + ui1.getUserage() + "---" + ui1.getUsersex());
//        }
    }
}
